<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta name="csrf-token" content="{{ csrf_token() }}">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    @include('comm/layuiCommStyle')
    @include('comm/comm')
    <title>用户更改</title>
</head>
<body>



    <div style="padding: 15px;">
        <blockquote class="layui-elem-quote">
            用户更改
        </blockquote>
    </div>

    @if (count($errors) > 0)
        <div class="alert alert-danger">
            <ul>
                @foreach ($errors->all() as $error)
                    <li>{{ $error }}</li>
                @endforeach
            </ul>
        </div>
    @endif
    @if(Session::has('message'))
        <div class="alert alert-info"> {{Session::get('message')}}
        </div>
    @endif
    <div class="container">

        <form class="layui-form layui-form-pane" action="{{url('/admins/promoter/editpromoter')}}" method="post">
            <div class="layui-form-item">
                <label class="layui-form-label">用户名:</label>
                <div class="layui-input-block">
                    <input type="text" name="username" required  lay-verify="required|username" value="{{$res->userName}}" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">密码:</label>
                <div class="layui-input-inline">
                    <input type="password" name="password" required lay-verify="required|password" value="{{$res->passWord}}" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">密码明文</div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">群id:</label>
                <div class="layui-input-block">
                    <input type="text" name="groupid" required  lay-verify="required" value="{{$res->groupId}}" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">群名:</label>
                <div class="layui-input-block">
                    <input type="text" name="grouptitle" required  lay-verify="required" value="{{$res->groupTitle}}" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">管理名:</label>
                <div class="layui-input-block">
                    <input type="text" name="groupname" required  lay-verify="required" value="{{$res->groupName}}" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">群PID:</label>
                <div class="layui-input-block">
                    <input type="text" name="pid" required  lay-verify="required" value="{{$res->PID}}" autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">管理QQ:</label>
                <div class="layui-input-block">
                    <input type="text" name="groupqq" required  lay-verify="required" value="{{$res->groupQQ}}" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">激活：</label>
                <div class="layui-input-block">
                    @if ($res->isAction == "1")
                        <input type="checkbox" name="isaction" lay-skin="switch" checked="true">
                    @else
                        <input type="checkbox" name="isaction" lay-skin="switch">
                    @endif
                </div>
            </div>
            <input type="hidden" name="id"  lay-verify="required" value="{{$res->id}}">
            {{ csrf_field() }}
            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                </div>
            </div>
        </form>

    </div>


</body>
<script>

//Demo
layui.use('form', function(){
    var form = layui.form;

    //监听提交
    form.on('submit(formDemo)', function(data){
        //layer.msg(JSON.stringify(data.field));
        return true;
    });

    form.verify({
        username: function(value, item){ //value：表单的值、item：表单的DOM对象
            if(!new RegExp("^[a-zA-Z0-9_\u4e00-\u9fa5\\s·]+$").test(value)){
                return '用户名不能有特殊字符';
            }
            if(/(^\_)|(\__)|(\_+$)/.test(value)){
                return '用户名首尾不能出现下划线\'_\'';
            }
            if(/^\d+\d+\d$/.test(value)){
                return '用户名不能全为数字';
            }
        }
        //我们既支持上述函数式的方式，也支持下述数组的形式
        //数组的两个值分别代表：[正则匹配、匹配不符时的提示文字]
        ,password: [
            /^[\S]{6,12}$/
            ,'密码必须6到12位，且不能出现空格'
        ]
    });

});


</script>
</html>